Skip to content

feat(orchestrator): add pipeline self-declaration - #404

Merged
JamyDev merged 3 commits into
mainfrom
jamy/orchestrator-pipeline
Jul 30, 2026
Merged

feat(orchestrator): add pipeline self-declaration#404
JamyDev merged 3 commits into
mainfrom
jamy/orchestrator-pipeline

Conversation

@JamyDev

@JamyDev JamyDev commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Introduces submitqueue/orchestrator/pipeline.go with the orchestrator's self-declaration
  • Deps struct: logger, scope, storage, counter, and four extension factories — the service's public API toward deployers
  • Stages: all 12 pipeline stages as a []pipeline.Stage[Deps] typed table, each with primary controller + DLQ reconciler
  • PublishOnlyTopics: log, merge-conflict-check, runway-merge
  • Controllers struct + NewControllers: RPC controllers (Ping), not bound to any wire contract
  • Pure addition alongside existing main.go — no behavioral changes

Step 3 of the Modular Queue Wiring RFC. Stacked on #403.

Test plan

  • bazel build //submitqueue/orchestrator:go_default_library compiles
  • All existing tests pass
  • make gazelle — BUILD.bazel in sync
  • make fmt — code formatted

Issues

https://linear.app/uber/issue/CODEM-209/example-figure-out-a-better-structure-for-wiring-up

Stack

@JamyDev JamyDev changed the title feat(platform): add StageContext to pipeline.Stage constructors feat(orchestrator): add pipeline self-declaration Jul 20, 2026
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from e091f18 to 538faea Compare July 21, 2026 17:59
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from 538faea to 1a44af2 Compare July 23, 2026 00:28
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from 1a44af2 to ac8e2fe Compare July 24, 2026 16:55
@JamyDev
JamyDev marked this pull request as ready for review July 24, 2026 17:31
@JamyDev
JamyDev requested review from a team, behinddwalls and sbalabanov as code owners July 24, 2026 17:31
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from ac8e2fe to b676033 Compare July 24, 2026 18:09
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from b676033 to ebbfac0 Compare July 24, 2026 18:32
@uber uber deleted a comment from CLAassistant Jul 24, 2026
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from ebbfac0 to d8c5add Compare July 24, 2026 18:42
@uber uber deleted a comment from CLAassistant Jul 24, 2026
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch 2 times, most recently from c09aea1 to a3d65e3 Compare July 24, 2026 19:02
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from a3d65e3 to 4655d7a Compare July 29, 2026 17:48
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from 4655d7a to e3743d4 Compare July 30, 2026 05:44
@JamyDev
JamyDev added this pull request to the merge queue Jul 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because the pull requests in the stack were not ordered correctly in the queue Jul 30, 2026
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from e3743d4 to 4d386f4 Compare July 30, 2026 06:06
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from 4d386f4 to f87e2c6 Compare July 30, 2026 17:31
Base automatically changed from jamy/platform-pipeline to main July 30, 2026 17:37
JamyDev and others added 3 commits July 30, 2026 17:52
Introduce `submitqueue/orchestrator/pipeline.go` with three exports:

- `Deps` struct: the full set of dependencies (logger, scope, storage,
  counter, and four extension factories) the orchestrator pipeline
  needs. This struct IS the service's public API toward deployers.

- `Stages` slice: the complete 12-stage pipeline topology as a typed
  table of `pipeline.Stage[Deps]`. Each row declares a primary
  controller constructor and its DLQ reconciler. Adding a stage =
  adding one row.

- `PublishOnlyTopics`: topics the orchestrator publishes to but does
  not consume (log, merge-conflict-check, runway-merge).

- `Controllers` struct + `NewControllers`: RPC-facing controllers
  (currently Ping), NOT bound to any wire contract.

Pure addition alongside the existing main.go wiring — no behavioral
changes.

Ref: doc/rfc/submitqueue/modular-queue-wiring.md (Step 3)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The score controller package does not exist — scoring was folded into
the speculator. Remove the score stage from Stages, the Scorer field
from Deps, and the controller/score import. Update the pipeline
diagram comment accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
One consumer group ("orchestrator") for all topics in the service,
matching the convention that per-stage groups are unnecessary unless
instances are split by stage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JamyDev
JamyDev force-pushed the jamy/orchestrator-pipeline branch from f87e2c6 to 6cab8e9 Compare July 30, 2026 18:01
@JamyDev
JamyDev added this pull request to the merge queue Jul 30, 2026
Merged via the queue into main with commit 0223d89 Jul 30, 2026
15 checks passed
@JamyDev
JamyDev deleted the jamy/orchestrator-pipeline branch July 30, 2026 18:11
behinddwalls added a commit that referenced this pull request Jul 30, 2026
## Summary

### Why?

PR #443 disabled this workflow outright (`if: false`) when the repo moved to GitHub's native stacked PRs. That was too blunt: native stacks and hand-rolled `arh` chains coexist here today. Stacks #470, #472 and #474 are native, while #460#461#462#463#476 is a plain chain whose every member reports `stack: null`. With the workflow off, merging any PR in a hand-rolled chain leaves the children still carrying their parent's commits — precisely the broken-diff problem this workflow was written to fix.

GitHub owns the lifecycle of its own stacks: on a partial merge it rebases and retargets the surviving members itself, so the workflow must not touch those. It only needs to tell the two apart rather than give up on both.

### What?

Re-enables the job and skips only the PRs GitHub actually owns, instead of switching the whole workflow off.

A `detect_stack` helper resolves native-stack membership from `GET /repos/{owner}/{repo}/pulls/{n}`. It queries the REST API at run time rather than reading `github.event.pull_request.stack` off the webhook payload, so a PR added to a stack after the merge event was queued is still recognised. Membership survives merge — a merged member still reports its stack — which is what makes the lookup meaningful at this point in the lifecycle.

The check is applied **per child PR**, not to the merged PR. GitHub only ever rebases a stack's own members; a PR that targets a member's head branch without joining the stack is invisible to that machinery. Skipping the whole chain whenever the merged PR happened to be a stack member would therefore strand such a PR with exactly the broken diff this workflow exists to prevent. `rebase_chain` always runs; each child that is a stack member is skipped and not recursed into, while its siblings rebase normally. Membership of the merged PR is logged for context and gates nothing.

Presence is tested on the `stack` object itself rather than on `stack.number`. Probing a sub-field means a stack object arriving without that field reads as "standalone" and gets force-pushed — the unsafe direction to fail in. The number is used only for logging. An unreadable response still falls back to standalone, since the Stacks API 404s when the feature is not enabled for a repo, which is exactly when the rebase is wanted.

`cleanup_orphaned_merged_branches` still runs on every merge, including those where every child turned out to be GitHub's to rebase. This workflow therefore remains the sole owner of head-branch deletion, and native-stack head branches are reaped here too, each on the first merge after GitHub has retargeted its successors off it.

This depends on "Automatically delete head branches" being OFF, as the header has always documented — otherwise GitHub retargets children to `main` before the job runs and the non-native path silently no-ops on a green job. The setting has been turned off on the repo.

## Test Plan

✅ YAML parses; job `if` and step `env` verified after the edit.

✅ `bash -n` clean on the extracted `run:` block under bash 5.2, the version Actions runners use. Note for future edits: macOS `/bin/bash` 3.2 reports a spurious `syntax error near ';;'` on this script — it cannot parse the heredoc nested in `$( )`, so it blames a line far from the real construct.

✅ `actionlint` v1.7.7 — clean.

✅ `zizmor` v1.25.2 (`--no-online-audits`, the version CI pins) — no findings, 2 ignored and 5 suppressed, confirming the existing `.github/zizmor.yml` exceptions still cover the file.

✅ `yamlfmt` v0.16.0 `-lint` — clean.

✅ `detect_stack` exercised against live PRs in this repo:

| PR | `.stack` | Result |
| --- | --- | --- |
| #467 | stack #470, position 4/6, merged | native → skipped |
| #468 | stack #470, position 5/6, open | native → skipped |
| #404 | stack #472 | native → skipped |
| #457 | stack #475, size 1 | native → skipped |
| #443 | `null` | standalone → rebased |
| #460 | `null` | standalone → rebased |
| #999999 | HTTP 404 | warns, treated as standalone, no `set -euo pipefail` abort |

✅ The sub-field trap verified directly: a synthetic `{"stack":{"id":51488,"position":4,"size":6}}` with no `number` reads as standalone under `.stack.number // empty`, and as in-a-stack under the expression shipped here.

✅ Observed reference case — the merge of #467 (position 4 of stack #470). GitHub retargeted #468 from `preetam/stovepipe-buildsignal-outcome` to `main` and left #469 on #468's branch, confirming both that GitHub handles its own members and that a merged member retains its `stack` object.

The rebase itself can only be exercised post-merge. On the next merge of a hand-rolled chain (the runway series is the live case) watch for `=== Stack rebase complete ===` and a child retargeted with only its own commits; on a native-stack merge watch for each member child logging `skipped: belongs to native stack #N`, followed by the branch sweep. The first sweep will also reap `preetam/stovepipe-buildsignal-outcome`, which is currently orphaned — it merged after auto-delete was turned off and has no open dependents.
behinddwalls added a commit that referenced this pull request Jul 30, 2026
## Summary

### Why?

PR #443 disabled this workflow outright (`if: false`) when the repo
moved to GitHub's native stacked PRs. That was too blunt: native stacks
and hand-rolled `arh` chains coexist here today. Stacks #470, #472 and
#474 are native, while #460#461#462#463#476 is a plain chain
whose every member reports `stack: null`. With the workflow off, merging
any PR in a hand-rolled chain leaves the children still carrying their
parent's commits — precisely the broken-diff problem this workflow was
written to fix.

GitHub owns the lifecycle of its own stacks: on a partial merge it
rebases and retargets the surviving members itself, so the workflow must
not touch those. It only needs to tell the two apart rather than give up
on both.

### What?

Re-enables the job and skips only the PRs GitHub actually owns, instead
of switching the whole workflow off.

A `detect_stack` helper resolves native-stack membership from `GET
/repos/{owner}/{repo}/pulls/{n}`. It queries the REST API at run time
rather than reading `github.event.pull_request.stack` off the webhook
payload, so a PR added to a stack after the merge event was queued is
still recognised. Membership survives merge — a merged member still
reports its stack — which is what makes the lookup meaningful at this
point in the lifecycle.

The check is applied **per child PR**, not to the merged PR. GitHub only
ever rebases a stack's own members; a PR that targets a member's head
branch without joining the stack is invisible to that machinery.
Skipping the whole chain whenever the merged PR happened to be a stack
member would therefore strand such a PR with exactly the broken diff
this workflow exists to prevent. `rebase_chain` always runs; each child
that is a stack member is skipped and not recursed into, while its
siblings rebase normally. Membership of the merged PR is logged for
context and gates nothing.

Presence is tested on the `stack` object itself rather than on
`stack.number`. Probing a sub-field means a stack object arriving
without that field reads as "standalone" and gets force-pushed — the
unsafe direction to fail in. The number is used only for logging. An
unreadable response still falls back to standalone, since the Stacks API
404s when the feature is not enabled for a repo, which is exactly when
the rebase is wanted.

`cleanup_orphaned_merged_branches` still runs on every merge, including
those where every child turned out to be GitHub's to rebase. This
workflow therefore remains the sole owner of head-branch deletion, and
native-stack head branches are reaped here too, each on the first merge
after GitHub has retargeted its successors off it.

This depends on "Automatically delete head branches" being OFF, as the
header has always documented — otherwise GitHub retargets children to
`main` before the job runs and the non-native path silently no-ops on a
green job. The setting has been turned off on the repo.

## Test Plan

✅ YAML parses; job `if` and step `env` verified after the edit.

✅ `bash -n` clean on the extracted `run:` block under bash 5.2, the
version Actions runners use. Note for future edits: macOS `/bin/bash`
3.2 reports a spurious `syntax error near ';;'` on this script — it
cannot parse the heredoc nested in `$( )`, so it blames a line far from
the real construct.

✅ `actionlint` v1.7.7 — clean.

✅ `zizmor` v1.25.2 (`--no-online-audits`, the version CI pins) — no
findings, 2 ignored and 5 suppressed, confirming the existing
`.github/zizmor.yml` exceptions still cover the file.

✅ `yamlfmt` v0.16.0 `-lint` — clean.

✅ `detect_stack` exercised against live PRs in this repo:

| PR | `.stack` | Result |
| --- | --- | --- |
| #467 | stack #470, position 4/6, merged | native → skipped |
| #468 | stack #470, position 5/6, open | native → skipped |
| #404 | stack #472 | native → skipped |
| #457 | stack #475, size 1 | native → skipped |
| #443 | `null` | standalone → rebased |
| #460 | `null` | standalone → rebased |
| #999999 | HTTP 404 | warns, treated as standalone, no `set -euo
pipefail` abort |

✅ The sub-field trap verified directly: a synthetic
`{"stack":{"id":51488,"position":4,"size":6}}` with no `number` reads as
standalone under `.stack.number // empty`, and as in-a-stack under the
expression shipped here.

✅ Observed reference case — the merge of #467 (position 4 of stack
#470). GitHub retargeted #468 from
`preetam/stovepipe-buildsignal-outcome` to `main` and left #469 on
#468's branch, confirming both that GitHub handles its own members and
that a merged member retains its `stack` object.

The rebase itself can only be exercised post-merge. On the next merge of
a hand-rolled chain (the runway series is the live case) watch for `===
Stack rebase complete ===` and a child retargeted with only its own
commits; on a native-stack merge watch for each member child logging
`skipped: belongs to native stack #N`, followed by the branch sweep. The
first sweep will also reap `preetam/stovepipe-buildsignal-outcome`,
which is currently orphaned — it merged after auto-delete was turned off
and has no open dependents.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants